home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / rkpls301.zip / RKPDEMO.ZIP / GENFILE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-04  |  2KB  |  79 lines

  1. Program GenFile;
  2.  
  3. {
  4.  This is a sample programme using RkPlus.  It is a sample of a key file
  5.  generation programme that would be used by the programmer to create
  6.  key files to be distributed to registered users.  The programme itself
  7.  would NOT be distributed, as it would allow users to generate key
  8.  files.  This sample can create a limited use Sample key file or full
  9.  registration key file, for the Sample1 and Sample2 programmes.
  10.  
  11.  GenFile uses the example encoding unit Encode.
  12. }
  13.  
  14.  
  15. Uses
  16.   Crt,
  17.   Dos,
  18.   RkPlus,
  19.   Encode;
  20.  
  21.  
  22. Const
  23.   MonthNames : Array[1..12] of String[3]
  24.   = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  25.  
  26.  
  27. Var
  28.   kc          : Char;
  29.   ey,em,dd,dw : Word;
  30.  
  31.  
  32. Begin
  33.   SetProgID('Sample');
  34.   SetKeyFile('Sample');
  35.   WriteLn('GenFile');
  36.   WriteLn('Key File Generation Programme for Sample1/Sample2');
  37.   WriteLn('See RKPLUS.DOC for more info');
  38.   WriteLn;
  39.   WriteLn('GenFile would be used by the programmer to create key files.');
  40.   WriteLn('It would NOT be distributed.');
  41.   WriteLn;
  42.   Write('Enter name of person to register : ');
  43.   ReadLn(Rkp.Name1);
  44.   WriteLn;
  45.   Write('Is this a limited use demo? ');
  46.   kc := UpCase(ReadKey);
  47.   WriteLn(kc);
  48.   WriteLn;
  49.   If (kc in ['Y','y']) then Begin
  50.     GetDate(ey,em,dd,dw);
  51.     If (em = 12) then Begin
  52.       em := 1;
  53.       Inc(ey);
  54.     End Else
  55.       Inc(em);
  56.     WriteLn('Creating limited use demo key (will expire 1-',MonthNames[em],'-',ey,')');
  57.     Rkp.Level := 0;
  58.     Rkp.ExpYear := ey;
  59.     Rkp.ExpMonth := em;
  60.     Rkp.ExpDay := 0;
  61.   End Else Begin
  62.     WriteLn('Creating unlimited registration key');
  63.     Rkp.Level := 1;
  64.     Rkp.ExpYear := 0;
  65.     Rkp.ExpMonth := 0;
  66.     Rkp.ExpDay := 0;
  67.   End;
  68.   Rkp.ID := '(c) Serious Cybernetics';
  69.   Rkp.Message := 'GenFile';
  70.   Rkp.Name2 := '';
  71.   Rkp.Name3 := '';
  72.   CreateKey;
  73.   SaveRegInfo;
  74.   If Rkp.Registered then
  75.     WriteLn(KeyFileName,' created.')
  76.   Else
  77.     WriteLn('Error ',RkpError,' creating file.');
  78. End.
  79.